﻿using System;
using System.Collections.Generic;
using System.Linq.Expressions;
using System.Text;
using System.Threading.Tasks;
using MiniProject.Models;

namespace MiniProject.ViewModels
{//由李伯轩完成
    public interface IFundStorage {
        /// <summary>
        /// 初始化
        /// </summary>
        /// <returns></returns>
        Task InitializeAsync();

        /// <summary>
        /// 判断是否已经初始化
        /// </summary>
        /// <returns></returns>
        bool IsInitialized();

        /// <summary>
        /// 获取基金
        /// </summary>
        /// <param Name="code">基金代码</param>
        /// <returns></returns>
        Task<Fund> GetFundAsync(string code);
        /// <summary>
        /// 获取一组基金
        /// </summary>
        /// <param Name="where">where条件</param>
        /// <param Name="skip">跳过结果的数量</param>
        /// <param Name="take">返回结果的数量</param>
        /// <returns></returns>
        Task<List<Fund>> GetFundsAsync(
            Expression<Func<Fund,bool>> where, int skip,int take);
    }

    /// <summary>
    /// 基金存储常量
    /// </summary>
    public static class FundStorageConstants {
        /// <summary>
        /// 基金数据库版本号
        /// </summary>
        public const int Version = 1;

        public const string VersionKey =
            nameof(FundStorageConstants) + "." + nameof(Version);
    }
}
